home *** CD-ROM | disk | FTP | other *** search
- on readini whatfile
- if voidp(whatfile) then
- whatfile = "settings.ini"
- end if
- inistring = readFile(whatfile)
- if voidp(inistring) then
- exit
- end if
- inistring = strip0Achar(inistring)
- wpl = [:]
- numlines = inistring.line.count
- m = 0
- repeat while 1
- m = m + 1
- if m > numlines then
- exit repeat
- end if
- actuallineVal = inistring.line[m]
- if (actuallineVal contains "[") = 1 then
- delete actuallineVal.char[1]
- delete char -30000 of actuallineVal
- newProp = symbol(actuallineVal)
- tmpl = [:]
- repeat while 1
- m = m + 1
- if m > numlines then
- exit repeat
- end if
- actuallineVal = inistring.line[m]
- equalpos = offset("=", actuallineVal)
- if equalpos = 0 then
- exit repeat
- next repeat
- end if
- pr = symbol(actuallineVal.char[1..equalpos - 1])
- vl = actuallineVal.char[equalpos + 1..length(actuallineVal)]
- addProp(tmpl, pr, vl)
- end repeat
- addProp(wpl, newProp, tmpl)
- end if
- end repeat
- return wpl
- end
-
- on readFile fname
- fObj = new(xtra("FileIO"))
- if objectp(fObj) then
- openFile(fObj, fname, 1)
- thefile = readFile(fObj)
- closeFile(fObj)
- fObj = 0
- end if
- return thefile
- end
-
- on strip0Achar str
- repeat with m = 1 to the number of lines in str
- if charToNum(str.line[m].char[1]) = 10 then
- delete str.line[m].char[1]
- end if
- end repeat
- return str
- end
-